package 数学问题;


import java.util.Scanner;

public class 巧用进制解决天平问题 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
//        System.out.println(Integer.toString(n, 3));

        String s = new StringBuilder(Integer.toString(n, 3)).reverse().toString();
//        System.out.println(s);

        int jin = 0;
        StringBuilder str = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if ((jin + (s.charAt(i)) - '0')==1){
                str.append(1+" ");
                jin = 0;
                continue;
            }else if ((jin + (s.charAt(i)) - '0')==2){
                str.append(-1+" ");
                jin = 1;
            }else if ((jin + (s.charAt(i)) - '0')==0){
                str.append(0+" ");
                jin = 0;
            } else {
                str.append(0+" ");
                jin = 1;
            }
        }
        if (jin == 1){
            str.append(1);
        }

        String[] chars = String.valueOf(str).split("\\s");
        String re = "";
        for (int i = chars.length-1; i >=0; i--) {
            if (Integer.parseInt(chars[i])>0){
                re = re + "+"+mi(i);
            }else if (Integer.parseInt(chars[i])<0){
                re = re + "-"+mi(i);
            }else {
                continue;
            }

        }
        System.out.println(re.substring(1));

    }
    // 三的n次方
    static int mi(int n){

        int s = 1;
        for (int i = 0; i < n; i++) {
            s = s * 3;
        }
        return s;
    }
}
